<template>
    <div>
        <span style="font-size: 40px">A</span>
        <router-link to="/B/1" style="font-size: 40px">toB</router-link>
    </div>
</template>

<script>
    export default {
        name: "A",
        beforeRouteLeave (to, from, next) {
            // 导航离开该组件的对应路由时调用
            // 可以访问组件实例 `this`
            console.log("A组件内部的beforeRouteLeave")
            next()
        }
    }
</script>

<style scoped>

</style>